<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>E朝朝_忘记密码</title>
  <link href="${base}/resources/css/denglu.css" rel="stylesheet">
<script src="${base}/resources/js/jquery-1.7.2.min.js"></script>
<script src="${base}/resources/js/layer/layer.js"type="text/javascript" ></script>
<link type="image/x-icon" href="http://www.leyikao.com/files/system/2015/07-24/13210954b071869202.ico?6.2.3" rel="icon"/>
</head>
<body>
<div class="header">
    <div class="logo_wrap">
    	<span class="menuL">
      	 <h1><a href="${base}/welcome"><img src="${base}/resources/images/logo.png" alt="E朝朝企业版" style="border:none"></a></h1>
       </span>
       <span class="menuR">
       <p class="login1">
	   <a href="${base}/enterprise/login">登 录</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
	   <a href="${base}/enterprise/reg_start">注 册</a>
	   </p>
	   </span>
    </div>
</div>
<div class="container">
    <div class="content101">
        <div class="content_left101">
            <h1>校招神器神器</h1>
            <h4>校招神器</h4>
            <h2>校招神器神器</h2>
        </div>
        <div class="content_right101">
            <!--忘记密码 开始-->
            <div class="hhh101">
                <div class="head101">
                    <a href="${base}/enterprise/reg_start" class="zhuce101" style="background-color: #bec0bc;color: #fff;" >注册</a>
                    <span class="denglu101"  style="color: #2492ea;">忘记密码</span>
                </div>
                <div class="forgoten">
                    <ul>
                        <li class="phone101"><span>手 机 号:</span><input type="text" placeholder="手机号" id="phone" onkeyup="this.value=this.value.replace(/\D/g,'')"  maxlength='11'></li>
                        <li class="yanma"><span>验 证 码:</span><input type="text" placeholder="验证码" id="verify"><input type="button" id="btn" value="获取验证码" style="width: 102px;height: 43px;margin-top: -44px;padding-left:0px" /></li>
                        <li class="newpass"><span>新 密 码:</span><input type="password" value="" placeholder="新密码" id="password" maxlength='16'></li>
                        <li class="newpass"><span>确认密码:</span><input type="password" value="" placeholder="再次输入密码" id="password1" maxlength='16'></li>
                    </ul>
                </div>
                <div class="submit102" id="reLogin">
                    <span style="cursor: pointer;">重新登录</span>
                </div>
            </div>
            <!--忘记密码 结束-->
        </div>
    </div>
</div>
 <#include "../common/bottom.ftl">
</body>
<script>
$base = "${base}";
var index1="";
document.getElementById("btn").onclick=function(){
var phone = $("#phone").val();
 if(phone == null || phone == ''){
	 index1=layer.alert("手机号不能为空!", {icon: 0,skin: 'layer-ext-moon'});
        $("#phone").focus()
       return false;
 }else{
	var chephone =/1[34578]{1}\d{9}$/;
	if(!chephone.test(phone)){
		index1=layer.alert("请输入正确的手机号!", {icon: 0,skin: 'layer-ext-moon'});
		$("#phone").focus();
		return false;
	}
}
 $.post($base + '/enterprise/verifyForgot',{
		'phone':phone,
	},function(data){
		if(data.result==0){
			index1=layer.alert(data.message, {icon: 2,skin: 'layer-ext-moon'});
			$("#phone").focus();
		}else{
			index1=layer.alert("验证码已发送，请注意查收!", {icon: 1,skin: 'layer-ext-moon'});
			time(document.getElementById("btn")); 
			$("#phone").focus();
		}
	});

} 
$(document).keydown(function(event){ 
	if(event.keyCode == 13){ //绑定回车 
		 if(index1!=""&&index1!=null){
			   layer.close(index1);
	           index1="";
	     }else{
	    	 $('#reLogin').click(); //自动触发登录按钮 	
	     }
	} 
});
     //重新登录
     $("#reLogin").click(function(){
     	var userName = $("#phone").val();
 	    if(userName == null || userName == ''){
 	    	index1=layer.alert("手机号不能为空!", {icon: 0,skin: 'layer-ext-moon'});
 	            	$("#phone").focus();
 	            	return false;
 	    }
 	    var password = $("#password").val();
 	    if(password == null || password == ''){
 	    	index1=layer.alert("密码不能为空!", {icon: 0,skin: 'layer-ext-moon'});
 	           $("#password").focus()
 	           return false;
 	    }else{
 	    	var chePassword =/^(?=.{6,16})(?=.*[a-z])(?=.*[0-9])[0-9a-z]*$/;
 			if(!chePassword.test(password)){
 				index1=layer.alert("请输入6—16位数字和字母组合!", {icon: 0,skin: 'layer-ext-moon'});
 				return false;
 			}
 	    }
 	   var password1 = $("#password1").val();
	    if(password1 != password){
	    	index1=layer.alert("请确认密码!", {icon: 0,skin: 'layer-ext-moon'});
	           $("#password1").focus()
	           return false;
	    }
 	    var chkCode = $("#verify").val();
 	    if(chkCode == null || chkCode == ''){
 	    	index1=layer.alert("验证码不能为空!", {icon: 0,skin: 'layer-ext-moon'});
 	           $("#verify").focus()
 	           return false;
 	    }		
 	   $.post($base + '/enterprise/reLogin',{
	 			'userName':userName,
	 			'password':password,
	 			'verify':chkCode
	 		},function(data){
	 			if(data.result==1){
	 				index1=layer.alert(data.message, {icon: 1,skin: 'layer-ext-moon'});
	 				location.href= $base;
	 			}else{
	 				index1=layer.alert(data.message, {icon: 2,skin: 'layer-ext-moon'});
	 			}
	 		});
     });
 </script>
<script type="text/javascript">
    var wait=60;
    function time(t) {
        if (wait == 0) {
            t.removeAttribute("disabled");
            t.value="免费获取验证码";
            wait = 60;
        } else {
            t.setAttribute("disabled", true);
            t.value="重新发送(" + wait + ")";
            wait--;
            setTimeout(function() {
                        time(t)
                    },
                    1000)
        }
    }
 
</script>
</html>